using System;
using System.Collections.Generic;
using System.Text;

namespace BuildingStructuralElements.Loads
{
    [Serializable]
    public class LoadingCase :MVCFramework .IModelData 
    {
        public enum LCType { G, Q };
        private int id;
        private string name;
        private LCType loadCaseType = LCType.G;

        #region Properties

        public int Id
        {
            get { return id; }
            set { id = value; }

        }

        public string Name
        {
            get { return name; }
            set { name = value; }

        }

        public LCType LoadingCaseType
        {
            get { return loadCaseType; }
            set { loadCaseType = value; }

        }

        private float selfWightMultiplier;
        public float SelfWightMultiplier
        {
            get { return selfWightMultiplier; }
            set { selfWightMultiplier = value; }
        }

        #endregion

        public LoadingCase()
        {
            id = 0;
            name = "";
        }

        public LoadingCase(int Id, string Name, LCType type)
        {
            id = Id;
            name = Name;
            loadCaseType = type;

        }

        public override string ToString()
        {
            return Name;
        }

        # region " operators Implemetation "
        public static bool operator ==(LoadingCase lc1, LoadingCase lc2)
        {
            object o1 = lc1;
            object o2 = lc2;

            if (o1 == null && o2 == null) return true;
            if (o1 == null) return false;
            if (o2 == null) return false;

            if (AreaEqual(lc1, lc2))
                return true;
            else
                return false;

        }
        private static bool AreaEqual(LoadingCase lc1, LoadingCase lc2)
        {
            if (lc1.LoadingCaseType == lc2.LoadingCaseType && lc1.name == lc2.name) return true;
            else return false;

        }

        public static bool operator !=(LoadingCase lc1, LoadingCase lc2)
        {
            return !(lc1 == lc2);
        }

        public override bool Equals(object obj)
        {
            if (obj is LoadingCase)
                return (bool)(this == (LoadingCase)obj);
            else return false;
        }
        #endregion
    }
}
